#include <bits/stdc++.h>
using namespace std;

void solve()
{
    string s;
    cin >> s;
    int n = s.size();
    int i = 0, j = n - 1;
    while (s[i] == 'l' || s[i] == 'q' || s[i] == 'b')
        i++;
    while (s[j] == 'l' || s[j] == 'q' || s[j] == 'b')
        j--;
    for (; i <= j; i++, j--)
    {
        if (s[i] != s[j])
        {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _;
    cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}